function FastBoost(integral_img, labels, weights)

num_of_labels = length(labels);

for i = 1:num_of_labels
    % Compute z_c
    cur_label = labels(i);
    tmp_weights = weights;
    tmp_weights(find(labels ~= cur_label)) = 0;
    z(cur_label) = sum(tmp_weights);
    
    % Compute m_c
    tmp_img = integral_img;
    tmp_img(find(labels ~= cur_label)) = 0;
    m(cur_label) = inv(z(cur_label)) * sum(tmp_weights * tmp_img);
    
    % Compute covmat_c
    covmat(cur_label) = inv(z(cur_label)) * sum(tmp_weights * tmp_img * tmp_img') - m(cur_label) * m(cur_label)';
    
end % for i

for i = 1:num_of_features
    cur_feature = features(i);
    for j = 1:num_of_labels
        cur_label = labels(j);
        
        % Compute mu_t_c
        mu(cur_feature, cur_label) = m(cur_label)' * g(cur_feature);
        % Compute sigma2_t_c
        sigma2(cur_feature, cur_label) = g(cur_feature)' * covmat(cur_label) * g(cur_feature);
    end % for j
    
end % for i

